/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cz.muni.fi.veles.circle;

import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.render.Renderer;

/**
 * Renderer base of circle {@link AbstractCircle} component
 * @author Jan Ferko
 */
@ResourceDependencies({
    @ResourceDependency(name="circle.js", target="head")
})
public class CircleRendererBase extends Renderer {
    /**
     * Method returns key of map server
     * @param component component which is rendered
     * @return  key of map server or empty string if component is null 
     *  or is not instance of {@link AbstractCircle}
     */
    public String getMapServer(UIComponent component){
        if(component == null || !(component instanceof AbstractCircle)){
            return "";
        }
       AbstractCircle circle = (AbstractCircle) component;
       return circle.resolveMapServer().getId();
    }
}
